import socket
# 创建socket对象
sk = socket.socket()

# 设置监听IP地址和端口号
sk.bind(('0.0.0.0',8999))

# 设置监听
## 监听中可挂起的最大连接数量
sk.listen(5)

# 服务端-等待连接
connection,addr = sk.accept()

print(connection)
print(addr)

while True:
    accept_data = connection.recv(1024)
    print("收到客户端发送消息：",accept_data.decode('utf8'))
    send_data = "收到!"
    connection.send(send_data.encode('utf8'))
